<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('【请填写功能名称】列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label style="width: 100px">监测点名称：</label>
                                <select name="monitorId" id="monitorId" >
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('bus:data:edit')}]];
        var removeFlag = [[${@permission.hasPermi('bus:data:remove')}]];
        var prefix = ctx + "bus/data";
        $(document).ready(function(){
            loadDepartmentName();
        });
        function loadDepartmentName() {
            $.ajax({
                url: prefix+"/monitorName",
                type: "post",
                success: function (data) {
                    var nameOpt = "<option value='' selected='selected'>--请选择--</option>";
                    for (var i = 0; i < data.length; i++) {
                        nameOpt+="<option value='"+data[i].monitorId+"' >"+data[i].monitorName+"</option>"
                        $('#monitorId').html(nameOpt);
                    }
                }
            });
        };
        $(function() {
            var options = {
                url: prefix + "/busDataMonth",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                showUrl: prefix + "/show/{id}",
                modalName: "【请填写功能名称】",
                columns: [
                {
                    field: 'mnCode',
                    title: '监测点MN编号',
                },
                {
                    field: 'monitorName',
                    title: '监测点名称',
                    formatter: function(value, row, index){
                        return '<a  href="/bus/data/show/'+ row.monitorId+ '">' + value + '</a>';
                    }
                },
                {
                    field: 'produceTime',
                    title: '产生时间'
                },
                {
                    field: 'ad',
                    title: '氨氮(mg/L)',
                    formatter: function(value, row, index){
                        // debugger
                        if(row.adFlag=="1") {
                            return '<span style="color:#fa4347">'+value+'</span>';
                        }else{
                            return value;
                        }
                    }
                },
                {
                    field: 'zl',
                    title: '总磷(mg/L)',
                    formatter: function(value, row, index){
                        // debugger
                        if(row.zlFlag=="1") {
                            return '<span style="color:#fa4347">'+value+'</span>';
                        }else{
                            return value;
                        }
                    }
                },
                {
                    field: 'cod',
                    title: '高锰酸盐',
                    formatter: function(value, row, index){
                        // debugger
                        if(row.codFlag=="1") {
                            return '<span style="color:#fa4347">'+value+'</span>';
                        }else{
                            return value;
                        }
                    }
                },
                {
                    field: 'ph',
                    title: 'PH',
                    formatter: function(value, row, index){
                        // debugger
                        if(row.phFlag=="1") {
                            return '<span style="color:#fa4347">'+value+'</span>';
                        }else{
                            return value;
                        }
                    }
                },
                {
                    field: 'cond',
                    title: '电导率',
                    formatter: function(value, row, index){
                        // debugger
                        if(row.condFlag=="1") {
                            return '<span style="color:#fa4347">'+value+'</span>';
                        }else{
                            return value;
                        }
                    }
                },
                {
                    field: 'ry',
                    title: '溶氧',
                    formatter: function(value, row, index){
                        // debugger
                        if(row.ryFlag=="1") {
                            return '<span style="color:#fa4347">'+value+'</span>';
                        }else{
                            return value;
                        }
                    }
                },
                {
                    field: 'zd',
                    title: '浊度',
                    formatter: function(value, row, index){
                        // debugger
                        if(row.zdFlag=="1") {
                            return '<span style="color:#fa4347">'+value+'</span>';
                        }else{
                            return value;
                        }
                    }
                },
                {
                    field: 'wd',
                    title: '温度',
                    formatter: function(value, row, index){
                        // debugger
                        if(row.wdFlag=="1") {
                            return '<span style="color:#fa4347">'+value+'</span>';
                        }else{
                            return value;
                        }
                    }
                },
                {
                    field: 'cr',
                    title: '六价铬',
                    formatter: function(value, row, index){
                        // debugger
                        if(row.crFlag=="1") {
                            return '<span style="color:#fa4347">'+value+'</span>';
                        }else{
                            return value;
                        }
                    }
                }


                ]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>